<template>
  <section>
    <!-- 面包屑 -->
 <breadcrumbs></breadcrumbs>
    <div class="data-container scroll-table">
      <!-- 按钮列表 -->
      <el-table :data="tableData"
                border
                style="width: 100%"
                @selection-change="tableSelectionChange">
        <el-table-column type="index"
                         label="序号"
                         width="50">
        </el-table-column>
        <el-table-column prop="houseId"
                         label="仓库编号">
        </el-table-column>
        <el-table-column prop="houseName"
                         label="仓库名称">
        </el-table-column>
        <el-table-column prop="address"
                         label="详细地址">
        </el-table-column>
        <el-table-column prop="contactsName"
                         label="负责人">
        </el-table-column>
        <el-table-column prop="contactsPhone"
                         label="联系电话">
        </el-table-column>
        <el-table-column prop="addtime"
                         label="创建时间">
        </el-table-column>
        <el-table-column prop="state"
                         label="状态">
          <template slot-scope="scope">
            <div v-if="scope.row.state==1">启用</div>
            <div v-if="scope.row.state==0">禁用</div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination class="mgt-10 pd-0"
                     @size-change="handleSizeChange"
                     @current-change="handleCurrentChange"
                     :current-page="searchForm.current"
                     :page-sizes="[10, 20, 30, 50]"
                     :page-size="searchForm.size"
                     layout="total, sizes, prev, pager, next, jumper"
                     :total="searchForm.totalCount">
      </el-pagination>
    </div>
  </section>
</template>

<script>
import breadcrumbs from "@/components/breadcrumbs.vue";
export default {
  name: "houseDetail",
   components: {

    breadcrumbs,
  },
  data () {
    return {
      opId: "",
      tableData: [],
      searchForm: {
        current: 1,
        size: 10,
        totalCount: 0
      },
    }
  },
  created () {
    // console.log(this.$route.query.id)
    this.opId = this.$route.query.opId;
    this.houseData(this.searchForm.current, this.searchForm.size, this.opId);
  },
  methods: {
    houseData (curr, size, oid) {
      this.$api.operate.getAdminOpHouseList({
        current: curr,
        size: size,
        opId: oid
      }).then(res => {
        if (res.code == 200) {
          this.tableData = res.data
          this.searchForm = {
            size: res.pageSize,
            totalCount: res.totalCount
          }
        }
      })
    },
    handleSizeChange (v) {
      console.log(v)
      this.searchForm.size = v;
      this.houseData(this.searchForm.current, v, this.opId);
    },
    handleCurrentChange (v) {
      this.searchForm.current = v;
      this.getTableData(v, this.searchForm.size, this.opId);
    },
    tableSelectionChange (val) {
      this.tableSelection = val;
    },
  }
}
</script>

<style scoped>
</style>